package com.level.restful.util;

import java.io.Serializable;

public class ResponseResult<T>  implements Serializable {
    private static final long serialVersionUID = 7285065610386199394L;
    private String code;
    private String message;
    private T response;

    public ResponseResult() {
        this.code = IStatusMessage.SystemStatus.ERROR.getCode();
        this.message = IStatusMessage.SystemStatus.ERROR.getMessage();
    }

    public ResponseResult(String code,String message,T response){
        this.code = code;
        this.message = message;
        this.response = response;
    }

    public ResponseResult(IStatusMessage statusMessage){
        this.code = statusMessage.getCode();
        this.message = statusMessage.getMessage();

    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public T getResponse() {
        return response;
    }

    public void setResponse(T response) {
        this.response = response;
    }

    @Override public String toString() {
        return "ResponseResult{" + "code='" + code + '\'' + ", message='"
                + message + '\'' + ", response=" + response + '}';
    }
}
